package com.xu.cloud.auth.enums;

import lombok.Getter;
import org.springframework.lang.Nullable;

/**
 * 第三方平台标识枚举
 *
 * @author xuguan
 * @since 2025/2/26
 */
@Getter
@SuppressWarnings("SpellCheckingInspection")
public enum ThirdPartyEnum {
    WECHAT("wechat", "微信"),
    QQ("qq", "QQ"),
    WEIBO("weibo", "微博"),
    GITEE("gitee", "Gitee"),
    GITHUB("github", "GitHub"),
    ;

    private final String thirdPartyType;
    private final String thirdPartyDesc;

    ThirdPartyEnum(String thirdPartyType, String thirdPartyDesc) {
        this.thirdPartyType = thirdPartyType;
        this.thirdPartyDesc = thirdPartyDesc;
    }

    @Nullable
    public static ThirdPartyEnum getByThirdPartyType(String thirdPartyType) {
        for (ThirdPartyEnum thirdPartyEnum : ThirdPartyEnum.values()) {
            if (thirdPartyEnum.getThirdPartyType().equals(thirdPartyType)) {
                return thirdPartyEnum;
            }
        }
        return null;
    }
}
